package com.fr.cell.editor;

import com.fr.cell.Grid;
import com.fr.cell.core.GUICoreUtils;
import com.fr.report.CellElement;
import com.fr.util.Utils;
import java.awt.Component;
import javax.swing.JComboBox;

public class ComboBoxCellEditor extends AbstractCellEditor
{
  private JComboBox comboBox;

  public ComboBoxCellEditor(Object[] paramArrayOfObject)
  {
    this.comboBox = new JComboBox(paramArrayOfObject);
    this.comboBox.setFocusTraversalKeysEnabled(false);
  }

  public Object getCellEditorValue()
    throws Exception
  {
    return this.comboBox.getSelectedItem();
  }

  public Component getCellEditorComponent(Grid paramGrid, CellElement paramCellElement)
  {
    Object localObject = null;
    if (paramCellElement != null)
      localObject = paramCellElement.getValue();
    if (localObject == null)
      localObject = "";
    GUICoreUtils.setSelectedItem(this.comboBox, Utils.objectToString(localObject));
    return ((Component)this.comboBox);
  }
}